package com.example.control.adapter;

import android.view.View;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.control.R;
import com.example.control.bean.MenuResponse;

import java.util.List;

/**
 * @Author : dushaohui
 * @Time : on 2024/3/12 8:38
 * @Description : MenuAdapter
 *
 *  菜单列表适配器
 */
public class MenuAdapter extends BaseQuickAdapter<MenuResponse.DataBean, BaseViewHolder> {
    private int[] iconArray = {R.drawable.icon_friend, R.drawable.icon_wallet, R.drawable.icon_location
            , R.drawable.icon_phone, R.drawable.icon_email, R.drawable.icon_share, R.drawable.icon_send};


    public MenuAdapter(int layoutResId, List<MenuResponse.DataBean> data) {
        super(layoutResId, data);
    }


    @Override
    protected void convert(BaseViewHolder helper, MenuResponse.DataBean item) {
        helper.setText(R.id.tv_menu_name,item.getName());
        //添加点击事件
        helper.addOnClickListener(R.id.tv_menu_name);

        ImageView imageView = helper.getView(R.id.iv_menu_icon);
      //  imageView.setImageResource(iconArray[helper.getAdapterPosition()]);
    }
}
